/*==============================================================================
FILE NAME: Create_Survey_Data.do
INPUTS: Citizen Complaints Survey_June 7, 2022_08.40.csv
OUTPUTS: citizen_complaints_clean.csv
CREATED: 1 July 2025
==============================================================================*/

* Import raw data
import delimited "$raw_data/Citizen Complaints Survey_June 7, 2022_08.40.csv", clear varnames(1)

* Drop unnecessary columns
drop in 1/44

* Keep variables for analysis
keep q2 q3 q4 q5 q6 q8 q9 q10 q11 q12 q13* durationinseconds

* Rename variables for analysis
rename q2 sex
rename q3 age
rename q4 education
rename q5 ethnicity
rename q6 race
rename q8 state
rename q9 county
rename q10 zipcode
rename q11 politics
rename q12 ever
rename durationinseconds duration

* Rename q13 variables
local newnames better_information better_job ej bad_info basic_rights undue_influence
local i = 1
foreach new in `newnames' {
	rename q13_`i' `new'
	local ++i
}

* Save file
export delimited using "$processed_data/citizen_complaints_clean.csv", replace

